#include<iostream>
#include<cstring>
using namespace std;
class Date
{
    private:
        int year,month,day;
    public:
        //无参构造函数
        Date(){ }
        //构造函数
        Date(int y,int m,int d):year(y),month(m),day(d){ }
        int getYear()
        {
            return year;
        }
        int getMonth()
        {
            return month;
        }
        int getDay()
        {
            return day;
        }
        //普通初始化函数
        void setDate(int y,int m,int d);
        void print();
        void addOneDay();
};

void Date::setDate(int y,int m,int d)
{
    year=y;
    month=m;
    day=d;
}
void Date::print()
{
    //这个输出要注意这个输出格式
    printf("Today is %d/%02d/%02d\n",year,month,day);
    addOneDay();
    printf("Tomorrow is %d/%02d/%02d\n",year,month,day);
}
void Date::addOneDay()
{
    int days[]={31,28,31,30,31,30,31,31,30,31,30,31};
    if((year%100!=0 && year%4==0) || (year%400==0))
    {
        days[1]++;
        //闰年加一天
    }
    day+=1;
    if(day>days[month-1])
    {
        day=day-days[month-1];
        month++;
        if(month>12)
        {
            month-=12;
            year++;
        }
    }
}
int main()
{
    int time;
    cin>>time;
    int flag=1;
    while(time--)
    {
        int a,b,c;
        cin>>a>>b>>c;
        //因为题目要求，构造函数和setDate要交互使用，所以用个flag调控
        if(flag)
        {
            Date tmp(a,b,c);
            tmp.print();
            flag=0;
        }
        else
        {
            Date tmp;
            tmp.setDate(a,b,c);
            tmp.print();
            flag=1;
        }
    }
}